package com.sky.module.system.permission.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sky.module.system.permission.domain.entity.Permission;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author zsg
 * @since 2023-02-20
 */
@Mapper

public interface PermissionMapper extends BaseMapper<Permission> {

    //    根据用户id查询权限菜单列表
    public List<Permission> findPermissionListByUserId(Long userId);

    /***
     * @description 根据当前用户 的角色id 查询出所拥有的权限信息
     * @param roleId
     * @return java.util.List<com.zsg.entity.Permission>
     * @date 2023/2/23 10:31
     *
     */
    List<Permission> findPermissionListByRoleId(Long roleId);



    /**
     * 删除角色权限关系
     * @param roleId
     */
    @Delete("delete from sys_role_permission where role_id = #{roleId}")
    void deleteRolePermission(Long roleId);
}
